package com.gaoyi.crm.db.entity;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;

import com.gaoyi.crm.db.CrmDatabase;

import java.util.Date;
import java.util.List;

@Entity(tableName = CrmDatabase.TABLE_PMN)
public class Pmn extends BaseEntity implements Parcelable {
    private String code;
    private String enName;
    private String cnName;
    private int state;
    private String turnDownReason;
    private String turnDownerId;
    private String remark;
    private Date startDate;
    private Date syncedAt; // 同步时间
    private int syncedStatus; // 同步状态 1:同步下载成功，0：修改未上传，2：上传成功

    @ColumnInfo(name = "custId")
    private String customerId;
    @ColumnInfo(name = "custEnName")
    private String customerEnName;
    @ColumnInfo(name = "custCnName")
    private String customerCnName;
    private String description;

    @Ignore
    private List<PmnAttach> images;
    @Ignore
    private List<ItemNoStore> itemNos;

    @Ignore
    private boolean isCheck;

    public boolean isCheck() {
        return isCheck;
    }

    public void setCheck(boolean check) {
        isCheck = check;
    }

    public Pmn() {
    }

    protected Pmn(Parcel in) {
        code = in.readString();
        enName = in.readString();
        cnName = in.readString();
        state = in.readInt();
        turnDownReason = in.readString();
        turnDownerId = in.readString();
        remark = in.readString();
        syncedStatus = in.readInt();
        customerId = in.readString();
        customerEnName = in.readString();
        customerCnName = in.readString();
        description = in.readString();
        images = in.createTypedArrayList(PmnAttach.CREATOR);
        itemNos = in.createTypedArrayList(ItemNoStore.CREATOR);
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(code);
        dest.writeString(enName);
        dest.writeString(cnName);
        dest.writeInt(state);
        dest.writeString(turnDownReason);
        dest.writeString(turnDownerId);
        dest.writeString(remark);
        dest.writeInt(syncedStatus);
        dest.writeString(customerId);
        dest.writeString(customerEnName);
        dest.writeString(customerCnName);
        dest.writeString(description);
        dest.writeTypedList(images);
        dest.writeTypedList(itemNos);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<Pmn> CREATOR = new Creator<Pmn>() {
        @Override
        public Pmn createFromParcel(Parcel in) {
            return new Pmn(in);
        }

        @Override
        public Pmn[] newArray(int size) {
            return new Pmn[size];
        }
    };

    public List<PmnAttach> getImages() {
        return images;
    }

    public void setImages(List<PmnAttach> images) {
        this.images = images;
    }

    public List<ItemNoStore> getItemNos() {
        return itemNos;
    }

    public void setItemNos(List<ItemNoStore> itemNos) {
        this.itemNos = itemNos;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getCustomerEnName() {
        return customerEnName;
    }

    public void setCustomerEnName(String customerEnName) {
        this.customerEnName = customerEnName;
    }

    public String getCustomerCnName() {
        return customerCnName;
    }

    public void setCustomerCnName(String customerCnName) {
        this.customerCnName = customerCnName;
    }

    public Date getSyncedAt() {
        return syncedAt;
    }

    public void setSyncedAt(Date syncedAt) {
        this.syncedAt = syncedAt;
    }

    public int getSyncedStatus() {
        return syncedStatus;
    }

    public void setSyncedStatus(int syncedStatus) {
        this.syncedStatus = syncedStatus;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getEnName() {
        return enName;
    }

    public void setEnName(String enName) {
        this.enName = enName;
    }

    public String getCnName() {
        return cnName;
    }

    public void setCnName(String cnName) {
        this.cnName = cnName;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getTurnDownReason() {
        return turnDownReason;
    }

    public void setTurnDownReason(String turnDownReason) {
        this.turnDownReason = turnDownReason;
    }

    public String getTurnDownerId() {
        return turnDownerId;
    }

    public void setTurnDownerId(String turnDownerId) {
        this.turnDownerId = turnDownerId;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

}
